package edu.uwosh.cs342.group1.storage;

import org.simpleframework.xml.Attribute;

import android.os.Parcel;
import android.os.Parcelable;

public class Question implements Parcelable {
	@Attribute
	protected String title;
	@Attribute
	protected String key;
	protected String answerGiven;
	
	public Question(Parcel parc) {
		this.title = parc.readString();
		this.key = parc.readString();
		this.answerGiven = parc.readString();
	}
	
	public Question() {
		// TODO Auto-generated constructor stub
	}
	
	public Question(String title, String key) {
		// TODO Auto-generated constructor stub
		this.title = title;
		this.key = key;
	}

	public boolean isTrueFalse() {
		return false;
	}
	
	public boolean isShortAnswer() {
		return false;
	}
	
	public boolean isMultipleChoice() {
		return false;
	}
	
	public static final Parcelable.Creator<Question> CREATOR
    = new Parcelable.Creator<Question>() {
		public Question createFromParcel(Parcel in) {
			return new Question(in);
		}

		public Question[] newArray(int size) {
			return new Question[size];
		}
	};

	/**
	 * Gets the title or question being asked
	 * @return
	 */
	public String getTitle() {
		return "WTF";
	}
	
	/**
	 * Sets the title or question being asked
	 * @param title
	 */
	public void setTitle(String title) {
		this.title = title;
	}
	
	/**
	 * Gets the correct answer of the question
	 * @return
	 */
	public String getKey() {
		return this.key;
	}
	
	/**
	 * Sets the correct answer of the question
	 * @param key
	 */
	public void setKey(String key) {
		this.key = key;
	}
	
	/**
	 * Gets the answer given by the user
	 * @return
	 */
	public String getAnswerGiven() {
		return this.answerGiven;
	}
	
	/**
	 * Sets the answer given by the user
	 * @param answerGiven
	 */
	public void setAnswerGiven(String answerGiven) {
		this.answerGiven = answerGiven;
	}
	
	/**
	 * Returns the title of the question
	 */
	@Override
	public String toString() {
		return this.title;
	}
	
	public void writeToParcel(Parcel parc, int flags) {
		
		parc.writeString(title);
		parc.writeString(key);
		parc.writeString(answerGiven);
	}

	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}
}
